package com.longdaji.decoration.ui.activitiesOfMine.personData.changeSignature;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.longdaji.decoration.Constants;
import com.longdaji.decoration.R;
import com.longdaji.decoration.base.BaseActivity;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ChangeSignatureActivity extends BaseActivity implements ChangeSignatureContract.IView {

    @Inject
    ChangeSignatureContract.IPresenter mPresenter;
    @BindView(R.id.tv_tool_title)
    TextView tvTitle;
    @BindView(R.id.et_change_signature)
    EditText etChangeSignature;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_change_signature);
        setUnBinder(ButterKnife.bind(this));

        if (mPresenter != null)
            mPresenter.setView(this);
        tvTitle.setText("个性签名");
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (mPresenter != null)
            mPresenter.detachView();
    }

    @OnClick({R.id.rl_tool_back, R.id.tv_finish})
    void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.rl_tool_back:
                finish();
                break;
            case R.id.tv_finish:
                Intent intent = new Intent();
                intent.putExtra("signature", etChangeSignature.getText().toString().trim());
                setResult(Constants.RESULT_CODE_CHANGE_SIGNATURE, intent);
                finish();
                break;
            default:
                break;
        }
    }

}
